<template>
  <div id="app">
    <MyTable :data="list">
    <template #default="obj">
        <button @click="Del(obj.row.id)">删除</button>
    </template>
    </MyTable>
    <MyTable :data="list2">
      <button @click="Add">查看</button>
    </MyTable>
  </div>
</template>
<style>

</style>
<script>
import MyTable from './components/MyTable.vue';

export default {
 components:{
  MyTable
 },
 data (){
  return {
    list :[
      { id: 1,name: '张三', age:18},
      { id: 2,name: '王五', age:20},
      { id: 3,name: '李四', age:34},
    ],
    list2:[
      { id: 1,name: '张小三', age:18},
      { id: 2,name: '王小五', age:20},
      { id: 3,name: '李小四', age:34},
    ]
  }
 },
 methods:{
  Del(id){
    this.list=this.list.filter(item => item.id!==id)
  },
  Add(){
    console.log('bb')
  }
 }
 }

</script>